<div class="row">
  <div class="col-xs-12 col-sm-6">

    <h4 class="breadcrumb"><%= t(:channels_my) %></h4>

    <div class="col-pad" data-no-turbolink>

      <%= button_to t(:new_model, model: 'Channel'), channels_path, :method => :post, :class => 'btn btn-primary' %><br>

      <% if @channels.length > 0 %>

        <table class="table table-striped table-bordered tablesorter">
          <thead>
            <tr>
              <th><%= t(:channel_name) %> <i class="fa fa-unsorted"></i></th>
              <th><%= t(:created) %> <i class="fa fa-unsorted"></i></td>
            </tr>
          </thead>
          <tbody>
            <% @channels.where(:social => false).each do |channel| %>
              <tr>
                <td>

                  <h4 style="margin-top: 0;">
                    <a href="/channels/<%= channel.id %>">
                      <i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i>
                      <%= channel.name %>
                    </a>
                  </h4>
                  <div class="btn-group btn-group-sm hidden-xs hidden-sm">
                    <%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview'), class: 'btn btn-default' %>
                    <%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview'), class: 'btn btn-default' %>
                    <%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings'), class: 'btn btn-default' %>
                    <%= link_to t(:api_key_link), channel_path(channel.id, :anchor => 'apikeys'), class: 'btn btn-default' %>
                    <%= link_to t(:data_import_link), channel_path(channel.id, :anchor => 'dataimport'), class: 'btn btn-default' %>
                  </div>

                </td>
                <td><%= channel.created_at.strftime("%Y-%m-%d") %></td>
              </tr>
            <% end %>
          </tbody>
        </table>
      <% end %>

      <% if current_admin_user.present? %>
        <br><br><br>
        <% @channels.each do |c| %>
          <% if c.social %>
            <%= t(:social_channel) %>: <%= link_to c.name, (Rails.env == 'production') ? "http://www.socialsensornetwork.com/#{c.slug}" : "/s/#{c.slug}" %>
            <br>
          <% end %>
        <% end %>
        <br>
        <%= link_to t(:social_channel_create), :controller => 'channels', :action => 'social_new' %>
      <% end %>

    </div>
  </div>

  <div id="sidebar" class="col-xs-12 col-sm-6">
    <h4 class="breadcrumb"><%= t(:help) %></h4>

    <div class="col-pad">

      <%= t(:help_channel) %>
      (<a href="/docs/channels"><%= t(:help_options) %></a>)
      <ul>
        <li><a href="http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/">Arduino Tutorial</a></li>
        <li><a href="http://community.thingspeak.com/tutorials/netduino/create-your-own-web-of-things-using-the-netduino-plus-and-thingspeak/">Netduino Plus Tutorial</a></li>
      </ul>

    </div>
  </div>

</div>

